package com.his.controller;


import com.his.entity.*;
import com.his.service.IScheduleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 排班时间表 前端控制器
 * </p>
 *
 * @author Demoon Liu
 * @since 2022-02-20
 */
@RestController
@Tag(name = "账单管理模块接口")
public class ScheduleController {

    @Autowired
    private IScheduleService iScheduleService;

    @PostMapping("/schedule/query1")
    @Operation(summary = "查询全部排班表信息", description = "返回全部排班表信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectAllSchedule(){
        return iScheduleService.selectAllSchedule();
    }

    @PostMapping("/schedule/query2")
    @Operation(summary = "查询全部排班规则表信息", description = "返回全部排班规则表信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectAllSchedule_rule(){
        return iScheduleService.selectAllSchedule_rule();
    }

    @PostMapping("/schedule/query3")
    @Operation(summary = "查询全部排班规则项表信息", description = "返回全部排班规则项表信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectAllSchedule_rule_item(){
        return iScheduleService.selectAllSchedule_rule_item();
    }

    @PostMapping("/schedule/insert1")
    @Operation(summary = "插入排班表", description = "除了Date，都需要插入")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "插入成功"),
            @ApiResponse(responseCode = "250", description = "插入失败"),
    })
    public ResponseResult insertSchedule(@RequestBody Schedule schedule){
        return iScheduleService.insertSchedule(schedule);
    }

    @PostMapping("/schedule/insert2")
    @Operation(summary = "插入排班规则表", description = "除了Operatetime，都需要插入")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "插入成功"),
            @ApiResponse(responseCode = "250", description = "插入失败"),
    })
    public ResponseResult insertSchedule_rule(@RequestBody ScheduleRule scheduleRule){
        return iScheduleService.insertSchedule_rule(scheduleRule);
    }

    @PostMapping("/schedule/insert3")
    @Operation(summary = "插入排班规则项表", description = "全部插入")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "插入成功"),
            @ApiResponse(responseCode = "250", description = "插入失败"),
    })
    public ResponseResult insertSchedule_rule_item(@RequestBody ScheduleRuleItem scheduleRuleItem){
        return iScheduleService.insertSchedule_rule_item(scheduleRuleItem);
    }

    @PostMapping("/schedule/delete1")
    @Operation(summary = "根据id删除排班信息", description = "根据排班id删除排班信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "删除成功"),
            @ApiResponse(responseCode = "250", description = "删除失败"),
    })
    public ResponseResult deleteSchedule(@RequestBody Schedule schedule){
        return iScheduleService.deleteSchedule(schedule);
    }

    @PostMapping("/schedule/delete2")
    @Operation(summary = "根据id删除排班规则信息", description = "根据排班规则id删除排班规则信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "删除成功"),
            @ApiResponse(responseCode = "250", description = "删除失败"),
    })
    public ResponseResult deleteSchedule_rule(@RequestBody ScheduleRule scheduleRule){
        return iScheduleService.deleteSchedule_rule(scheduleRule);
    }

    @PostMapping("/schedule/delete3")
    @Operation(summary = "根据id删除排班规则项信息", description = "根据排班规则项id删除排班规则项信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "删除成功"),
            @ApiResponse(responseCode = "250", description = "删除失败"),
    })
    public ResponseResult deleteSchedule_rule_item(@RequestBody ScheduleRuleItem scheduleRuleItem){
        return iScheduleService.deleteSchedule_rule_item(scheduleRuleItem);
    }

    @PostMapping("/schedule/query4")
    @Operation(summary = "根据部门id查询排班信息", description = "根据部门id查询排班信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectScheduleBydid(@RequestBody Schedule schedule){
        return iScheduleService.selectScheduleBydid(schedule);
    }

    @PostMapping("/schedule/query5")
    @Operation(summary = "根据部门id查询排班规则信息", description = "根据部门id查询排班规则信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectSchedule_ruledid(@RequestBody ScheduleRule scheduleRule){
        return iScheduleService.selectSchedule_ruledid(scheduleRule);
    }

    @PostMapping("/schedule/query6")
    @Operation(summary = "根据排班规则id查询排班规则项信息", description = "根据排班规则id查询排班规则项信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectSchedule_rule_itemsid(@RequestBody ScheduleRuleItem scheduleRuleItem){
        return iScheduleService.selectSchedule_rule_itemsid(scheduleRuleItem);
    }
}
